package com.lixinlei.springboot_servlet.controller.hello;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.ServletRequest;

@Controller
@RequestMapping("/hello")
public class HelloController {

    @RequestMapping("/sayHi")
    @ResponseBody
    public String sayHi() {
        System.out.println("*********************sayHi()");
        return "Hello World!";
    }

    @RequestMapping("/request/param")
    @ResponseBody
    public String requestParam(@RequestParam("name") String name, ServletRequest request) {
        System.out.println("**************Request Param -> name : " + name);
        String pName = request.getParameter("name");
        return "requestParam()";
    }

}
